const sumindex = require('../module/sumindex.js')

module.exports = {
    getmessage: (req, res, next) => {
        sumindex.getmessage().then(results => {
            req.sm = results[0].sm
            next()
        }).catch(err => {
            next(err)
        })
    },
    getsummes: (req, res, next) => {
        sumindex.getsummes().then(results => {
            req.title = results[0].title
            req.datetime = results[0].datetime
            next()
        }).catch(err => {
            next(err)
        })
    },

    getuser: (req, res, next) => {
        sumindex.getuser().then(resul => {
            req.su = resul[0].su
                //console.log(resul)
            next()
        }).catch(err => {
            next(err)
        })
    },
    getorder: (req, res, next) => {
        sumindex.getorder().then(results => {
            req.so = results[0].so
                //console.log(results)
            next()
        }).catch(err => {
            next(err)
        })
    },
    getmer: (req, res, next) => {
        sumindex.getmer().then(result => {
            req.smer = result[0].smer
                //console.log(result)
            next()
        }).catch(err => {
            next(err)
        })
    },




}